]> dgit.raspbian.org Git - gnome-shell.git/commit
cleanup: Minimize deep_unpack() usage
authorAlessandro Bono <alessandro.bono369@gmail.com>
Wed, 10 Aug 2022 09:44:42 +0000 (11:44 +0200)
committerMarge Bot <marge-bot@gnome.org>
Wed, 10 Aug 2022 10:29:24 +0000 (10:29 +0000)
commitade4b2379696a23b9d53a52bb751521cdfe7667a
tree6b873d3e87ae69fc95322ed01436c92f90b929d6
parent23bfd08b3c9b5b10f2afc3b4c01544742caef680
cleanup: Minimize deep_unpack() usage

deep_unpack()[1] will unpack a variant and its children, but only up to one level.
lookup_value()[2] will directly search for a value with a linear scan.

Performing a deep_unpack() + lookup can be a more expensive operation when we are
looking for just a single value compared to just perform the lookup_value() directly
in C. Avoid the deep_unpack() usage when we perform a single check presence.

[1] https://gjs.guide/guides/glib/gvariant.html#deepunpack
[2] https://docs.gtk.org/glib/method.Variant.lookup_value.html

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2416>
js/gdm/realmd.js
js/misc/modemManager.js
js/misc/smartcardManager.js
js/ui/status/location.js
js/ui/status/nightLight.js
js/ui/status/powerProfiles.js
js/ui/status/thunderbolt.js